home *** CD-ROM | disk | FTP | other *** search
/ PC Answers 1998 January / PC Answers Issue 49 Cover CD January 1998.iso / Apps / Director / DATA.Z / Widget Wizard.dir / WidgtBehaviors_32_play snd-2 picts.ls < prev    next >
Encoding:
Text File  |  1997-05-10  |  2.5 KB  |  86 lines

  1. property UpCM, DownCM, button_active, whichevent, WhichSound, WhichChannel, StartImmediately
  2.  
  3. on getPropertyDescriptionList
  4.   set description to [:]
  5.   if the currentSpriteNum = 0 then
  6.     set memdefault to 0
  7.   else
  8.     set memref to the member of sprite the currentSpriteNum
  9.     set castLibNum to the castLibNum of memref
  10.     set memdefault to member (the memberNum of member memref + 1) of castLib castLibNum
  11.   end if
  12.   addProp(description, #DownCM, [#default: memdefault, #format: #bitmap, #comment: "Pict for Down:"])
  13.   addProp(description, #whichevent, [#default: #mouseUp, #format: #symbol, #comment: "Play Sound On Which Event:", #range: [#mouseUp, #mouseDown, #mouseEnter, #mouseLeave, #mouseUpOutSide]])
  14.   addProp(description, #WhichChannel, [#default: 1, #format: #integer, #comment: "Which sound channel:"])
  15.   addProp(description, #WhichSound, [#default: EMPTY, #format: #sound, #comment: "Which cast member:"])
  16.   addProp(description, #StartImmediately, [#default: 0, #format: #boolean, #comment: "Start Immediately?:"])
  17.   return description
  18. end
  19.  
  20. on getBehaviorDescription
  21.   return "Button, auto set up pict, switch pict down,  Play a sound cast member. If the cast member is linked channel 1 only."
  22. end
  23.  
  24. on getAssocMembers
  25.   set myPropList to [DownCM, WhichSound]
  26.   return myPropList
  27. end
  28.  
  29. on beginSprite me
  30.   set the UpCM of me to the member of sprite the spriteNum of me
  31.   set the button_active of me to 0
  32.   puppetSprite(the spriteNum of me, 1)
  33. end
  34.  
  35. on endSprite me
  36.   puppetSprite(the spriteNum of me, 0)
  37. end
  38.  
  39. on do_it me
  40.   puppetSound(the WhichChannel of me, the WhichSound of me)
  41.   if the StartImmediately of me then
  42.     updateStage()
  43.   end if
  44. end
  45.  
  46. on mouseDown me
  47.   set the member of sprite the spriteNum of me to member the DownCM of me
  48.   set the button_active of me to 1
  49.   if the whichevent of me = #mouseDown then
  50.     do_it(me)
  51.   end if
  52. end
  53.  
  54. on mouseUp me
  55.   set the member of sprite the spriteNum of me to member the UpCM of me
  56.   set the button_active of me to 0
  57.   if the whichevent of me = #mouseUp then
  58.     do_it(me)
  59.   end if
  60. end
  61.  
  62. on mouseUpOutSide me
  63.   set the button_active of me to 0
  64.   if the whichevent of me = #mouseUpOutSide then
  65.     do_it(me)
  66.   end if
  67. end
  68.  
  69. on mouseLeave me
  70.   if the button_active of me then
  71.     set the member of sprite the spriteNum of me to member the UpCM of me
  72.   end if
  73.   if the whichevent of me = #mouseLeave then
  74.     do_it(me)
  75.   end if
  76. end
  77.  
  78. on mouseEnter me
  79.   if the button_active of me then
  80.     set the member of sprite the spriteNum of me to member the DownCM of me
  81.   end if
  82.   if the whichevent of me = #mouseEnter then
  83.     do_it(me)
  84.   end if
  85. end
  86.